package org.chen.action;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.bao.utils.MyUtils;
import org.chen.bean.UserReceiptAddressBean;
import org.chen.service.IRecAddressService;
import org.chen.service.impl.RecAddressServiceImpl;


/**
 * Servlet implementation class DelUserAddressinfo
 */
@WebServlet("/DelUserAddressinfo")
public class DelUserAddressinfo extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */

	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// 1、接收表单数据
		UserReceiptAddressBean adminB = MyUtils.convertFormData2Bean(request,UserReceiptAddressBean.class);
		// 2、调用service层进行数据保存
		int i = MyUtils.getInstance(RecAddressServiceImpl.class).DelUserAddress(adminB);
		// 3、根据保存处理结果进行页面转发
		// ajax响应
		// 响应客户单的请求
		PrintWriter pw = response.getWriter();
		// 将json字符串发回客户端浏览器
		pw.write("delok");
		pw.flush();
		pw.close();
	}
}
